import { del, get, post, put } from './request'

// 创建菜单
export const createMenu = (data) => {
  return post('/api/v1/menus', data)
}

// 删除菜单
export const delMenu = (id) => {
  return del(`/api/v1/menus/${id}`)
}

// 删除菜单及其子菜单
export const delWithChildrenMenu = (id) => {
  return del(`/api/v1/menus/${id}/with-children`)
}

// 更新菜单
export const updateMenu = (id) => {
  return put(`/api/v1/menus/${id}`)
}

// 查询所有菜单
export const findAllMenu = (params) => {
  return get('/api/v1/menus', params)
}

// 查询菜单信息
export const findMenuInfo = (id) => {
  return get(`/api/v1/menus/${id}`)
}

// 根据父菜单ID查询子菜单
export const findMenuParent = (parentId) => {
  return get(`/api/v1/menus/parent/${parentId}`)
}
